/*
* Copyright 2004-2010 mb_sx@hotmail.com
* All Rights Reserved.
*/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace DeskNotes
{
	/// <summary>
	/// Summary description for SettingsDialog.
	/// </summary>
	public class SettingsDialog : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button btnOK;
		private System.Windows.Forms.Button btnCancel;
		private System.Windows.Forms.ColorDialog colorDialog;
		private System.Windows.Forms.OpenFileDialog openSound;
		private System.Windows.Forms.ToolTip toolTip;
		private System.ComponentModel.IContainer components;
		internal string[] langs = new string[2]{new System.Globalization.CultureInfo("en-US").NativeName,
									 new System.Globalization.CultureInfo("cs-CZ").NativeName};
		private System.Windows.Forms.TabControl tabData;
		private System.Windows.Forms.TabPage tabPage1;
        private System.Windows.Forms.TabPage tabPage2;
        internal System.Windows.Forms.Button btnBackground;
		internal System.Windows.Forms.ComboBox comboLanguage;
        private System.Windows.Forms.Label label3;
		internal System.Windows.Forms.Button btnSound;
		internal System.Windows.Forms.TextBox txtSound;
		internal System.Windows.Forms.CheckBox chkSound;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Button btnFont;
		private System.Windows.Forms.FontDialog fontDialog;
		internal System.Windows.Forms.Label lblFont;
		internal System.Windows.Forms.CheckBox chkInsertOnlyDate;
		private System.Windows.Forms.TabPage tabPage3;
		private System.Windows.Forms.GroupBox groupBox1;
		internal System.Windows.Forms.RadioButton rbDragDrop;
        internal System.Windows.Forms.RadioButton rbArchive;
        private TabPage tabPage4;
        internal OwnControls.DataStorageControl dataStorage;
        internal CheckBox chkRemoveOutlook;
        private HelpProvider helpProvider1;
        internal CheckBox chkNewSwitchable;
        internal CheckBox chkFloatingCaption;
        private TextBox textBox1;

		//internal string opacityText;

		public SettingsDialog()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			
			//Display languages in combo using their native names
			comboLanguage.Items.AddRange(langs);
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingsDialog));
            this.btnOK = new System.Windows.Forms.Button();
            this.btnCancel = new System.Windows.Forms.Button();
            this.colorDialog = new System.Windows.Forms.ColorDialog();
            this.openSound = new System.Windows.Forms.OpenFileDialog();
            this.toolTip = new System.Windows.Forms.ToolTip(this.components);
            this.btnFont = new System.Windows.Forms.Button();
            this.lblFont = new System.Windows.Forms.Label();
            this.btnBackground = new System.Windows.Forms.Button();
            this.comboLanguage = new System.Windows.Forms.ComboBox();
            this.btnSound = new System.Windows.Forms.Button();
            this.txtSound = new System.Windows.Forms.TextBox();
            this.chkSound = new System.Windows.Forms.CheckBox();
            this.chkRemoveOutlook = new System.Windows.Forms.CheckBox();
            this.chkFloatingCaption = new System.Windows.Forms.CheckBox();
            this.tabData = new System.Windows.Forms.TabControl();
            this.tabPage1 = new System.Windows.Forms.TabPage();
            this.chkInsertOnlyDate = new System.Windows.Forms.CheckBox();
            this.label6 = new System.Windows.Forms.Label();
            this.tabPage3 = new System.Windows.Forms.TabPage();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.rbArchive = new System.Windows.Forms.RadioButton();
            this.rbDragDrop = new System.Windows.Forms.RadioButton();
            this.tabPage2 = new System.Windows.Forms.TabPage();
            this.chkNewSwitchable = new System.Windows.Forms.CheckBox();
            this.label3 = new System.Windows.Forms.Label();
            this.tabPage4 = new System.Windows.Forms.TabPage();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.dataStorage = new OwnControls.DataStorageControl();
            this.fontDialog = new System.Windows.Forms.FontDialog();
            this.helpProvider1 = new System.Windows.Forms.HelpProvider();
            this.tabData.SuspendLayout();
            this.tabPage1.SuspendLayout();
            this.tabPage3.SuspendLayout();
            this.groupBox1.SuspendLayout();
            this.tabPage2.SuspendLayout();
            this.tabPage4.SuspendLayout();
            this.SuspendLayout();
            // 
            // btnOK
            // 
            resources.ApplyResources(this.btnOK, "btnOK");
            this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.btnOK.Name = "btnOK";
            this.helpProvider1.SetShowHelp(this.btnOK, ((bool)(resources.GetObject("btnOK.ShowHelp"))));
            this.toolTip.SetToolTip(this.btnOK, resources.GetString("btnOK.ToolTip"));
            // 
            // btnCancel
            // 
            resources.ApplyResources(this.btnCancel, "btnCancel");
            this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.btnCancel.Name = "btnCancel";
            this.helpProvider1.SetShowHelp(this.btnCancel, ((bool)(resources.GetObject("btnCancel.ShowHelp"))));
            this.toolTip.SetToolTip(this.btnCancel, resources.GetString("btnCancel.ToolTip"));
            // 
            // openSound
            // 
            this.openSound.DefaultExt = "WAV";
            resources.ApplyResources(this.openSound, "openSound");
            // 
            // btnFont
            // 
            resources.ApplyResources(this.btnFont, "btnFont");
            this.btnFont.Name = "btnFont";
            this.helpProvider1.SetShowHelp(this.btnFont, ((bool)(resources.GetObject("btnFont.ShowHelp"))));
            this.toolTip.SetToolTip(this.btnFont, resources.GetString("btnFont.ToolTip"));
            this.btnFont.Click += new System.EventHandler(this.btnFont_Click);
            // 
            // lblFont
            // 
            resources.ApplyResources(this.lblFont, "lblFont");
            this.lblFont.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.lblFont.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.lblFont.Name = "lblFont";
            this.helpProvider1.SetShowHelp(this.lblFont, ((bool)(resources.GetObject("lblFont.ShowHelp"))));
            this.toolTip.SetToolTip(this.lblFont, resources.GetString("lblFont.ToolTip"));
            this.lblFont.FontChanged += new System.EventHandler(this.lblFont_FontChanged);
            this.lblFont.DoubleClick += new System.EventHandler(this.btnBackground_Click);
            // 
            // btnBackground
            // 
            resources.ApplyResources(this.btnBackground, "btnBackground");
            this.btnBackground.BackColor = System.Drawing.SystemColors.Control;
            this.btnBackground.ForeColor = System.Drawing.SystemColors.ControlText;
            this.btnBackground.Name = "btnBackground";
            this.helpProvider1.SetShowHelp(this.btnBackground, ((bool)(resources.GetObject("btnBackground.ShowHelp"))));
            this.toolTip.SetToolTip(this.btnBackground, resources.GetString("btnBackground.ToolTip"));
            this.btnBackground.UseVisualStyleBackColor = false;
            this.btnBackground.Click += new System.EventHandler(this.btnBackground_Click);
            // 
            // comboLanguage
            // 
            resources.ApplyResources(this.comboLanguage, "comboLanguage");
            this.comboLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboLanguage.Name = "comboLanguage";
            this.helpProvider1.SetShowHelp(this.comboLanguage, ((bool)(resources.GetObject("comboLanguage.ShowHelp"))));
            this.toolTip.SetToolTip(this.comboLanguage, resources.GetString("comboLanguage.ToolTip"));
            this.comboLanguage.SelectionChangeCommitted += new System.EventHandler(this.comboLanguage_SelectionChangeCommitted);
            // 
            // btnSound
            // 
            resources.ApplyResources(this.btnSound, "btnSound");
            this.btnSound.Name = "btnSound";
            this.helpProvider1.SetShowHelp(this.btnSound, ((bool)(resources.GetObject("btnSound.ShowHelp"))));
            this.toolTip.SetToolTip(this.btnSound, resources.GetString("btnSound.ToolTip"));
            this.btnSound.Click += new System.EventHandler(this.btnSound_Click);
            // 
            // txtSound
            // 
            resources.ApplyResources(this.txtSound, "txtSound");
            this.txtSound.Name = "txtSound";
            this.helpProvider1.SetShowHelp(this.txtSound, ((bool)(resources.GetObject("txtSound.ShowHelp"))));
            this.toolTip.SetToolTip(this.txtSound, resources.GetString("txtSound.ToolTip"));
            // 
            // chkSound
            // 
            resources.ApplyResources(this.chkSound, "chkSound");
            this.chkSound.Name = "chkSound";
            this.helpProvider1.SetShowHelp(this.chkSound, ((bool)(resources.GetObject("chkSound.ShowHelp"))));
            this.toolTip.SetToolTip(this.chkSound, resources.GetString("chkSound.ToolTip"));
            this.chkSound.CheckedChanged += new System.EventHandler(this.chkSound_CheckedChanged);
            // 
            // chkRemoveOutlook
            // 
            resources.ApplyResources(this.chkRemoveOutlook, "chkRemoveOutlook");
            this.chkRemoveOutlook.Name = "chkRemoveOutlook";
            this.helpProvider1.SetShowHelp(this.chkRemoveOutlook, ((bool)(resources.GetObject("chkRemoveOutlook.ShowHelp"))));
            this.toolTip.SetToolTip(this.chkRemoveOutlook, resources.GetString("chkRemoveOutlook.ToolTip"));
            this.chkRemoveOutlook.UseVisualStyleBackColor = true;
            // 
            // chkFloatingCaption
            // 
            resources.ApplyResources(this.chkFloatingCaption, "chkFloatingCaption");
            this.chkFloatingCaption.Name = "chkFloatingCaption";
            this.helpProvider1.SetShowHelp(this.chkFloatingCaption, ((bool)(resources.GetObject("chkFloatingCaption.ShowHelp"))));
            this.toolTip.SetToolTip(this.chkFloatingCaption, resources.GetString("chkFloatingCaption.ToolTip"));
            this.chkFloatingCaption.UseVisualStyleBackColor = true;
            // 
            // tabData
            // 
            resources.ApplyResources(this.tabData, "tabData");
            this.tabData.Controls.Add(this.tabPage1);
            this.tabData.Controls.Add(this.tabPage3);
            this.tabData.Controls.Add(this.tabPage2);
            this.tabData.Controls.Add(this.tabPage4);
            this.helpProvider1.SetHelpKeyword(this.tabData, resources.GetString("tabData.HelpKeyword"));
            this.helpProvider1.SetHelpNavigator(this.tabData, ((System.Windows.Forms.HelpNavigator)(resources.GetObject("tabData.HelpNavigator"))));
            this.tabData.Name = "tabData";
            this.tabData.SelectedIndex = 0;
            this.helpProvider1.SetShowHelp(this.tabData, ((bool)(resources.GetObject("tabData.ShowHelp"))));
            // 
            // tabPage1
            // 
            this.tabPage1.BackColor = System.Drawing.SystemColors.Control;
            this.tabPage1.Controls.Add(this.chkInsertOnlyDate);
            this.tabPage1.Controls.Add(this.btnFont);
            this.tabPage1.Controls.Add(this.lblFont);
            this.tabPage1.Controls.Add(this.label6);
            this.tabPage1.Controls.Add(this.btnBackground);
            this.helpProvider1.SetHelpKeyword(this.tabPage1, resources.GetString("tabPage1.HelpKeyword"));
            this.helpProvider1.SetHelpNavigator(this.tabPage1, ((System.Windows.Forms.HelpNavigator)(resources.GetObject("tabPage1.HelpNavigator"))));
            resources.ApplyResources(this.tabPage1, "tabPage1");
            this.tabPage1.Name = "tabPage1";
            this.helpProvider1.SetShowHelp(this.tabPage1, ((bool)(resources.GetObject("tabPage1.ShowHelp"))));
            // 
            // chkInsertOnlyDate
            // 
            resources.ApplyResources(this.chkInsertOnlyDate, "chkInsertOnlyDate");
            this.chkInsertOnlyDate.Name = "chkInsertOnlyDate";
            this.helpProvider1.SetShowHelp(this.chkInsertOnlyDate, ((bool)(resources.GetObject("chkInsertOnlyDate.ShowHelp"))));
            // 
            // label6
            // 
            resources.ApplyResources(this.label6, "label6");
            this.label6.Name = "label6";
            this.helpProvider1.SetShowHelp(this.label6, ((bool)(resources.GetObject("label6.ShowHelp"))));
            // 
            // tabPage3
            // 
            this.tabPage3.BackColor = System.Drawing.SystemColors.Control;
            this.tabPage3.Controls.Add(this.groupBox1);
            this.helpProvider1.SetHelpKeyword(this.tabPage3, resources.GetString("tabPage3.HelpKeyword"));
            this.helpProvider1.SetHelpNavigator(this.tabPage3, ((System.Windows.Forms.HelpNavigator)(resources.GetObject("tabPage3.HelpNavigator"))));
            resources.ApplyResources(this.tabPage3, "tabPage3");
            this.tabPage3.Name = "tabPage3";
            this.helpProvider1.SetShowHelp(this.tabPage3, ((bool)(resources.GetObject("tabPage3.ShowHelp"))));
            // 
            // groupBox1
            // 
            resources.ApplyResources(this.groupBox1, "groupBox1");
            this.groupBox1.Controls.Add(this.rbArchive);
            this.groupBox1.Controls.Add(this.rbDragDrop);
            this.groupBox1.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.groupBox1.Name = "groupBox1";
            this.helpProvider1.SetShowHelp(this.groupBox1, ((bool)(resources.GetObject("groupBox1.ShowHelp"))));
            this.groupBox1.TabStop = false;
            // 
            // rbArchive
            // 
            resources.ApplyResources(this.rbArchive, "rbArchive");
            this.rbArchive.Name = "rbArchive";
            this.helpProvider1.SetShowHelp(this.rbArchive, ((bool)(resources.GetObject("rbArchive.ShowHelp"))));
            // 
            // rbDragDrop
            // 
            resources.ApplyResources(this.rbDragDrop, "rbDragDrop");
            this.rbDragDrop.Name = "rbDragDrop";
            this.helpProvider1.SetShowHelp(this.rbDragDrop, ((bool)(resources.GetObject("rbDragDrop.ShowHelp"))));
            // 
            // tabPage2
            // 
            this.tabPage2.BackColor = System.Drawing.SystemColors.Control;
            this.tabPage2.Controls.Add(this.chkFloatingCaption);
            this.tabPage2.Controls.Add(this.chkNewSwitchable);
            this.tabPage2.Controls.Add(this.comboLanguage);
            this.tabPage2.Controls.Add(this.label3);
            this.tabPage2.Controls.Add(this.btnSound);
            this.tabPage2.Controls.Add(this.txtSound);
            this.tabPage2.Controls.Add(this.chkSound);
            this.helpProvider1.SetHelpKeyword(this.tabPage2, resources.GetString("tabPage2.HelpKeyword"));
            this.helpProvider1.SetHelpNavigator(this.tabPage2, ((System.Windows.Forms.HelpNavigator)(resources.GetObject("tabPage2.HelpNavigator"))));
            resources.ApplyResources(this.tabPage2, "tabPage2");
            this.tabPage2.Name = "tabPage2";
            this.helpProvider1.SetShowHelp(this.tabPage2, ((bool)(resources.GetObject("tabPage2.ShowHelp"))));
            // 
            // chkNewSwitchable
            // 
            resources.ApplyResources(this.chkNewSwitchable, "chkNewSwitchable");
            this.chkNewSwitchable.Name = "chkNewSwitchable";
            this.helpProvider1.SetShowHelp(this.chkNewSwitchable, ((bool)(resources.GetObject("chkNewSwitchable.ShowHelp"))));
            this.chkNewSwitchable.UseVisualStyleBackColor = true;
            // 
            // label3
            // 
            resources.ApplyResources(this.label3, "label3");
            this.label3.Name = "label3";
            this.helpProvider1.SetShowHelp(this.label3, ((bool)(resources.GetObject("label3.ShowHelp"))));
            // 
            // tabPage4
            // 
            this.tabPage4.BackColor = System.Drawing.SystemColors.Control;
            this.tabPage4.Controls.Add(this.chkRemoveOutlook);
            this.tabPage4.Controls.Add(this.textBox1);
            this.tabPage4.Controls.Add(this.dataStorage);
            this.helpProvider1.SetHelpKeyword(this.tabPage4, resources.GetString("tabPage4.HelpKeyword"));
            this.helpProvider1.SetHelpNavigator(this.tabPage4, ((System.Windows.Forms.HelpNavigator)(resources.GetObject("tabPage4.HelpNavigator"))));
            resources.ApplyResources(this.tabPage4, "tabPage4");
            this.tabPage4.Name = "tabPage4";
            this.helpProvider1.SetShowHelp(this.tabPage4, ((bool)(resources.GetObject("tabPage4.ShowHelp"))));
            // 
            // textBox1
            // 
            resources.ApplyResources(this.textBox1, "textBox1");
            this.textBox1.BackColor = System.Drawing.SystemColors.ControlLight;
            this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.textBox1.Name = "textBox1";
            this.textBox1.ReadOnly = true;
            this.helpProvider1.SetShowHelp(this.textBox1, ((bool)(resources.GetObject("textBox1.ShowHelp"))));
            // 
            // dataStorage
            // 
            resources.ApplyResources(this.dataStorage, "dataStorage");
            this.dataStorage.ArchiveFileName = "";
            this.dataStorage.CheckFileExists = true;
            this.dataStorage.DataFileName = "";
            this.dataStorage.Name = "dataStorage";
            this.dataStorage.OpenDirectory = false;
            this.helpProvider1.SetShowHelp(this.dataStorage, ((bool)(resources.GetObject("dataStorage.ShowHelp"))));
            // 
            // fontDialog
            // 
            this.fontDialog.ShowColor = true;
            // 
            // helpProvider1
            // 
            resources.ApplyResources(this.helpProvider1, "helpProvider1");
            // 
            // SettingsDialog
            // 
            resources.ApplyResources(this, "$this");
            this.Controls.Add(this.tabData);
            this.Controls.Add(this.btnCancel);
            this.Controls.Add(this.btnOK);
            this.helpProvider1.SetHelpKeyword(this, resources.GetString("$this.HelpKeyword"));
            this.helpProvider1.SetHelpNavigator(this, ((System.Windows.Forms.HelpNavigator)(resources.GetObject("$this.HelpNavigator"))));
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "SettingsDialog";
            this.helpProvider1.SetShowHelp(this, ((bool)(resources.GetObject("$this.ShowHelp"))));
            this.tabData.ResumeLayout(false);
            this.tabPage1.ResumeLayout(false);
            this.tabPage3.ResumeLayout(false);
            this.groupBox1.ResumeLayout(false);
            this.tabPage2.ResumeLayout(false);
            this.tabPage2.PerformLayout();
            this.tabPage4.ResumeLayout(false);
            this.tabPage4.PerformLayout();
            this.ResumeLayout(false);

		}
		#endregion

        internal void SetPreviewColors(Color fColor, Color bColor)
        {
            lblFont.BackColor = bColor;
            lblFont.ForeColor = fColor;
        }
		private void btnBackground_Click(object sender, System.EventArgs e)
		{
            colorDialog.Color = lblFont.BackColor;
            if (DialogResult.OK == colorDialog.ShowDialog(this))
            {
                lblFont.BackColor = colorDialog.Color;
            }
		}

		

		private void chkSound_CheckedChanged(object sender, System.EventArgs e)
		{
			txtSound.Enabled = chkSound.Checked;
			btnSound.Enabled = chkSound.Checked;
		}

		private void btnSound_Click(object sender, System.EventArgs e)
		{
			openSound.FileName = txtSound.Text;
			if (DialogResult.OK == openSound.ShowDialog())
			{
				txtSound.Text = openSound.FileName;
			}
		}

		

		/// <summary>
		/// Displays warning that language is changed only after restart.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void comboLanguage_SelectionChangeCommitted(object sender, System.EventArgs e)
		{
			MessageBox.Show(this,MainResource.GetString("LANGUAGE_CHANGED"),MainResource.GetString("APP_TITLE"),
				MessageBoxButtons.OK,MessageBoxIcon.Information);
				
		}

		private void btnFont_Click(object sender, System.EventArgs e)
		{
			fontDialog.Font = lblFont.Font;
            fontDialog.Color = lblFont.ForeColor;
			if (DialogResult.OK == fontDialog.ShowDialog()){
				lblFont.Font = fontDialog.Font;
                lblFont.ForeColor = fontDialog.Color;
            }
		}

		private void lblFont_FontChanged(object sender, System.EventArgs e)
		{
			lblFont.Text = lblFont.Font.Name;
        }
	}
}
